<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="../gsap.min.js"></script>
  <script src="../gsap-public/minified/ScrollTrigger.min.js"></script>
  <script src="../gsap-public/minified/ScrollToPlugin.min.js"></script>
  <title>缩放测试</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    
    .banner {
      background: gray;
      margin: 10px 0;
      height: 700px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 54px;
    }
    #fixed-box {
      width: 100vw;
      height: 100vh;
      background-color: rgba(250, 0, 250, .2);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    #container {
      width: 100vw;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: pink;
      transform: translate(0, 0);
    }
   
  </style>
</head>
<body>
  <div class="banner">1</div>
  <div class="banner">2</div>
  <div class="banner">3</div>
  <div class="banner">4</div>
  <div id="fixed-box">
    <div class="container" id="container"><h2>❤️</h2></div>
  </div>
  <div class="banner">5</div>
  <div class="banner">6</div>
  <script>
    gsap.registerPlugin(ScrollTrigger);

    gsap.to('#fixed-box', {
      scrollTrigger: {
        trigger: '#fixed-box',
        start: 'top 10px',
        end: '+=500',
        pin: true,
        anticipatePin: 0,
        scrub: true
      }
    });
  </script>
</body>
</html>